/*
* ECARX Technology Limited is the owner of the copyright and the trade secret of this software.
* Without permission, no one has the right to obtain, disclose or use this software in any way.
*/

package ecarx.eas.notification;


import android.app.PendingIntent;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * FileName: StatusBarTyrantNotification.java <br>
 * Description : 霸屏通知数据 <br>
 * Create Time: 2021/8/3 14:07 <br>
 * Update Time: 2021/8/3 14:07 <br>
 *
 * @since 1.0.0
 */
public class StatusBarTyrantNotification implements Parcelable {

    /**
     * 通知 id
     */
    private int id;

    /**
     * 发送霸屏通知方包名
     */
    private String pkgName;

    /**
     * 霸屏通知方标题
     */
    private String title;

    /**
     * 霸屏通知内容
     */
    private String content;

    /**
     * 霸屏通知内容点击事件
     */
    private PendingIntent contentIntent;

    /**
     * 删除通知事件
     */
    private PendingIntent deleteIntent;

    /**
     * 通知发送时间
     */
    private long when;

    /**
     * 是否为霸屏通知，如果为 false 则与普通通知无区别
     */
    private boolean isTyrant;

    /**
     * 霸屏通知按钮事件
     */
    private List<ITyrantAction> actions;

    private String className;

    public StatusBarTyrantNotification(int id, String pkgName, String title, String content, PendingIntent contentIntent, PendingIntent deleteIntent, long when, boolean isTyrant, List<ITyrantAction> actions ,String className) {
        this.id = id;
        this.pkgName = pkgName;
        this.title = title;
        this.content = content;
        this.contentIntent = contentIntent;
        this.deleteIntent = deleteIntent;
        this.when = when;
        this.isTyrant = isTyrant;
        this.actions = actions;
        this.className = className;
    }


    protected StatusBarTyrantNotification(Parcel in) {
        id = in.readInt();
        pkgName = in.readString();
        title = in.readString();
        content = in.readString();
        contentIntent = in.readParcelable(PendingIntent.class.getClassLoader());
        deleteIntent = in.readParcelable(PendingIntent.class.getClassLoader());
        when = in.readLong();
        isTyrant = in.readByte() != 0;
        actions = in.createTypedArrayList(ITyrantAction.CREATOR);
        className = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(pkgName);
        dest.writeString(title);
        dest.writeString(content);
        dest.writeParcelable(contentIntent, flags);
        dest.writeParcelable(deleteIntent, flags);
        dest.writeLong(when);
        dest.writeByte((byte) (isTyrant ? 1 : 0));
        dest.writeTypedList(actions);
        dest.writeString(className);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<StatusBarTyrantNotification> CREATOR = new Creator<StatusBarTyrantNotification>() {
        @Override
        public StatusBarTyrantNotification createFromParcel(Parcel in) {
            return new StatusBarTyrantNotification(in);
        }

        @Override
        public StatusBarTyrantNotification[] newArray(int size) {
            return new StatusBarTyrantNotification[size];
        }
    };

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public boolean isTyrant() {
        return isTyrant;
    }

    public void setTyrant(boolean tyrant) {
        isTyrant = tyrant;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPkgName() {
        return pkgName;
    }

    public void setPkgName(String pkgName) {
        this.pkgName = pkgName;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public List<ITyrantAction> getActions() {
        return actions;
    }

    public PendingIntent getContentIntent() {
        return contentIntent;
    }

    public void setContentIntent(PendingIntent contentIntent) {
        this.contentIntent = contentIntent;
    }

    public PendingIntent getDeleteIntent() {
        return deleteIntent;
    }

    public void setDeleteIntent(PendingIntent deleteIntent) {
        this.deleteIntent = deleteIntent;
    }

    public long getWhen() {
        return when;
    }

    public void setWhen(long when) {
        this.when = when;
    }

    public void setActions(List<ITyrantAction> actions) {
        this.actions = actions;
    }
}
